home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-19 / surfsrc3.zip / HIDNLINE.INC < prev    next >
Text File  |  1991-09-28  |  3KB  |  93 lines

  1. procedure HIDDENLINE;
  2.  
  3. { Make a hidden lines drawing of the object }
  4. var Node:                      word;          { node # }
  5.     Surf:                      word;          { surface # }
  6.     ch:                        char;
  7.     User_abort:                boolean;       { did the user abort? }
  8. {$ifndef BIGMEM}
  9.     Surfmin, Surfmax: surfaces;
  10.       { surface minimum & maximum (Ztran) }
  11. {$endif}
  12. label ABORTTEXT,                              { text-mode abort }
  13.       ABORTGRPH;                              { graphics-mode abort }
  14.  
  15. begin
  16. {$ifdef BIGMEM}
  17. with ptra^ do with ptrb^ do with ptrc^ do
  18. with ptrd^ do with ptre^ do with ptrf^ do
  19. with ptri^ do with ptrk^ do with ptrn^ do
  20. begin
  21. {$endif}
  22.   perf_start;
  23.   User_abort := TRUE;
  24.   if (Viewchanged) then begin
  25.     menumsg ('Transforming to 2-D...');
  26.     if (checkey) then goto ABORTTEXT;
  27. { Transform from 3-D to 2-D coordinates }
  28.     setorigin;
  29.     for Node := 1 to Nnodes do
  30.       perspect (Xworld[Node], Yworld[Node], Zworld[Node],
  31.                 Xtran[Node],  Ytran[Node],  Ztran[Node]);
  32.  
  33.     if (checkey) then goto ABORTTEXT;
  34. { Set plotting limits and normalize transformed coords to screen coords }
  35.     perspect (Xfocal, Yfocal, Zfocal, Xfotran, Yfotran, Zfotran);
  36.     if (not setnormal (Xfotran, Yfotran, XYmax)) then begin
  37.       menumsg ('Warning: Focal point outside data limits.');
  38.       writeln;
  39.       write   ('  Press any key ...');
  40.       ch := readkey;
  41.     { Erase the previous message }
  42.       menumsg ('');
  43.       writeln;
  44.       write ('                          ');
  45.     end;
  46.  
  47. { Normalize all the nodes }
  48.     for Node := 1 to Nnodes do
  49.       normalize (Xtran[Node], Ytran[Node], Xfotran, Yfotran, XYmax);
  50.  
  51.     menumsg ('Sorting surfaces...');
  52.     if (checkey) then goto ABORTTEXT;
  53.     minmax (Surfmin, Surfmax, Nsurf);
  54.     shelsurf (Surfmin, Surfmax, Nsurf);
  55.     Viewchanged := FALSE;
  56.   end; { if Viewchanged }
  57.  
  58. {$ifdef USE_IFF}
  59.   menumsg ('Plotting...');
  60. {$endif}
  61.   setgmode (Nmatl);
  62.   for Surf := 1 to Nsurf do begin
  63.     if (Nsides = 2) or (Visible (Surf, 1)) then begin
  64.       { First fill the surface in with black }
  65.       fillsurf (Surf, 0, 0);
  66.       { Now draw the border }
  67.       border (Surf, Matl[Surf]);
  68.     end;
  69.     if (grafstat) then goto ABORTGRPH;
  70.   end; { for Surf }
  71.   drawaxes (Xfotran, Yfotran, XYmax);
  72.  
  73.   perf_stop (3);
  74.  
  75. {$ifdef USE_IFF}
  76.   menumsg ('Saving IFF...');
  77.   saveiff (Filemask + '.IFF', VGApal);
  78. {$else}
  79.   { Wait for user keypress to continue }
  80.   continue;
  81. {$endif}
  82.   User_abort := FALSE;
  83.  
  84.   ABORTGRPH:
  85.   exgraphic;
  86.   ABORTTEXT:
  87.   if (User_abort) then
  88.     perf_stop (0);
  89. {$ifdef BIGMEM}
  90. end; {with}
  91. {$endif}
  92. end; {procedure HIDDENLINE }
  93.